Skip to content

Conversation

@clann24
Copy link

@clann24 clann24 commented Feb 26, 2025

When proxy_map contains None as value, the library will throw an exception, the proposed changes will fix the error:

proxy_map:
{'http://': Proxy('http://sys-proxy-rd-relay.xxxx.org:8119'), 'https://': Proxy('http://sys-proxy-rd-relay.xxxx.org:8119'), 'all://localhost': None}

Exception:
File /usr/local/lib/python3.11/dist-packages/httpx/_urlparse.py:411, in normalize_port(port, scheme) 409 port_as_int = int(port)
410 except ValueError:
--> 411 raise InvalidURL(f"Invalid port: {port!r}") 413 # See https://url.spec.whatwg.org/#url-miscellaneous 414 default_port = {"ftp": 21, "http": 80, "https": 443, "ws": 80, "wss": 443}.get( 415 scheme
416 )

InvalidURL: Invalid port: ':'

Summary

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

When proxy_map contains None as value, the library will throw an exception, the proposed changes will fix the error:

proxy_map:
{'http://': Proxy('http://sys-proxy-rd-relay.xxxx.org:8119'), 'https://': Proxy('http://sys-proxy-rd-relay.xxxx.org:8119'), 'all://localhost': None}

Exception:
File /usr/local/lib/python3.11/dist-packages/httpx/_urlparse.py:411, in normalize_port(port, scheme)
409 port_as_int = int(port)
410 except ValueError:
--> 411 raise InvalidURL(f"Invalid port: {port!r}")
413 # See https://url.spec.whatwg.org/#url-miscellaneous
414 default_port = {"ftp": 21, "http": 80, "https": 443, "ws": 80, "wss": 443}.get(
415 scheme
416 )

InvalidURL: Invalid port: ':'
@clann24 clann24 closed this Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant